package com.ruoyi.kanaimqtt.common;

import com.ruoyi.system.domain.app.DeviceWarning;
import com.ruoyi.system.mapper.app.DeviceWarningMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author lenovo
 * @ClassName BoxWaringUtil
 * @date 2021/4/21
 * @description: TODO
 **/
@Component
public class BoxWaringUtil {
    @Autowired
    DeviceWarningMapper deviceWarningMapper;

    public void addEvent(String deviceNum, Integer holeNum, Integer msgType, Integer type, String content) {
        DeviceWarning deviceWarning = new DeviceWarning();
        deviceWarning.setDeviceNum(deviceNum);
        deviceWarning.setHoleNum(holeNum);
        deviceWarning.setMsgType(msgType);
        deviceWarning.setWarningType(type);
        deviceWarning.setCreateTime(new Date());
        if (msgType == 2) {

        } else {
            deviceWarning.setContent(content);
        }

        deviceWarningMapper.insertSelective(deviceWarning);
    }
}
